<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSkillCourseTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('skill_course', function (Blueprint $table) {
            $table->unsignedBigInteger('skill_id')->index()->comment('技能ID');
            $table->unsignedBigInteger('course_id')->index()->comment('课程ID');
            $table->json('next_course_id')->nullable()->comment('连接下一个课程的ID');
            $table->decimal('complete_percentage')->default(0)->comment('完成百分比');
            $table->integer('step')->default(0)->comment('步骤编号');
            $table->primary(['skill_id', 'course_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('skill_course');
    }
}
